public class CombinationWords {
	  public void Combination ( String str ) {  
	    int length = str.length();
	    char[] in = str.toCharArray();
	    Arrays.sort(in);
	    StringBuffer out = new StringBuffer();

	    doCombination(length, in, out, 0);
	  }

	  public void doCombination(int length, char[] in, StringBuffer out, int pivot) {
	    for( int i = pivot; i < length; i++ ) {
	      out.append(in[i]);
	      System.out.println(out.toString());
	      
	      if(pivot+1 < length)
	      doCombination(length, in, out, ++pivot);
	      
	      out.setLength(out.length()-1);
	      
	    }
	  }
	}